package com.iot08.push.service;

import com.iot08.common.entity.app.VipMember;
import com.iot08.common.service.base.BaseService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;

/**
 * @author cwj
 * @description
 * @date 2025/7/9 14:43
 **/
@Slf4j
@Service
public class VipMemberService extends BaseService<VipMember> {

    public VipMember queryVipMemberByOpenid(String openid) {
        long currentTime = System.currentTimeMillis()/1000;
        return this.findOne(new Query(Criteria.where("openid").is(openid).and("isVip").is(1).and("endTime").gte(currentTime)));
    }

}
